package com.example.demo.service.impl;

import com.example.demo.mapper.RegionMapper;
import com.example.demo.mapper.entity.Area;
import com.example.demo.mapper.entity.City;
import com.example.demo.mapper.entity.Province;
import com.example.demo.service.RegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Lucy
 * @create 2024-02-20 14:53
 */
@Service
public class RegionServiceImpl implements RegionService {

    @Autowired
    private RegionMapper mapper;

    @Override
    public List<Province> buildProvinceList() {
        return mapper.allProvince();
    }

    @Override
    public List<City> buildCitiesListByProvinceId(String provinceId) {
        return mapper.findCityByFather(provinceId);
    }

    @Override
    public List<Area> buildAreasListByCityId(String cityId) {
        return mapper.findAreaByFather(cityId);
    }

    @Override
    public String selectProvinceNameById(String provinceId) {
        return mapper.selectProvinceNameById(provinceId);
    }

    @Override
    public String selectCityNameById(String cityId) {
        return mapper.selectCityNameById(cityId);
    }

    @Override
    public String selectAreaNameById(String areaId) {
        return mapper.selectAreaNameById(areaId);
    }
}
